package org.jivesoftware.smackx.pubsub;

import org.jivesoftware.smackx.Form;
import org.jivesoftware.smackx.packet.DataForm;

public class FormNode extends NodeExtension
{
  private Form configForm;

  public FormNode(FormNodeType paramFormNodeType, String paramString, Form paramForm)
  {
    super(paramFormNodeType.getNodeElement(), paramString);
    if (paramForm == null)
      throw new IllegalArgumentException("Submit form cannot be null");
    this.configForm = paramForm;
  }

  public FormNode(FormNodeType paramFormNodeType, Form paramForm)
  {
    super(paramFormNodeType.getNodeElement());
    if (paramForm == null)
      throw new IllegalArgumentException("Submit form cannot be null");
    this.configForm = paramForm;
  }

  public Form getForm()
  {
    return this.configForm;
  }

  public String toXML()
  {
    String str;
    if (this.configForm == null)
    {
      str = super.toXML();
      return str;
    }
    StringBuilder localStringBuilder = new StringBuilder("<");
    localStringBuilder.append(getElementName());
    if (getNode() != null)
    {
      localStringBuilder.append(" node='");
      localStringBuilder.append(getNode());
      localStringBuilder.append("'>");
    }
    while (true)
    {
      while (true)
      {
        localStringBuilder.append(this.configForm.getDataFormToSend().toXML());
        localStringBuilder.append("</");
        localStringBuilder.append(getElementName() + '>');
        str = localStringBuilder.toString();
      }
      localStringBuilder.append('>');
    }
  }
}